/*
 * Copyright 2009 BioTeam Inc
 * 
 * Licensed under License GNU LESSER GENERAL PUBLIC LICENSE version 3.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.gnu.org/copyleft/lesser.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package net.bioteam.appweb.gwt.apps.clientandserver.user;

import net.bioteam.cloud.cluster.ActiveCluster;
import net.bioteam.cloud.cluster.ClusterData;
import net.bioteam.appweb.gwt.apps.clientandserver.ClusterInfo;
import net.bioteam.appweb.gwt.apps.clientandserver.ServerException;
import net.bioteam.appweb.model.ProgramTemplate;
import net.bioteam.appweb.submit.RunStatus;
import net.bioteam.common.user.User;
import net.bioteam.common.user.UserInfo;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("user/useraction")
public interface UserAction extends RemoteService
{

	public static class Util
	{

		public static UserActionAsync getInstance()
		{

			UserActionAsync ret= GWT.create(UserAction.class);
			//ServiceDefTarget st=(ServiceDefTarget)ret;
			//st.setServiceEntryPoint(GWT.getModuleBaseURL()+"user/useraction");
			
			return ret;
		}
	}
	
	
	
	public String deletetemplate(String[] ids) throws ServerException;
	
	public ProgramTemplate[] updateTemplates(ProgramTemplate[] runs) throws ServerException;
	
	public ProgramTemplate[] getTemplates() throws ServerException;
	
	public String deleteJobs(String[] ids) throws ServerException;
	public String killJob(String id) throws ServerException;

	
	public JobRet getJobs(int start, int limit, String sort, String direction) throws ServerException;
	public RunStatus refreshJob(long id) throws ServerException;
	public User getAccount() throws ServerException;
	public User changePassword(String oldPw, String newPw) throws ServerException;
	public User changeEmail(String email) throws ServerException;
	public String deleteEc2Info() throws ServerException;
	public User attachEC2Info(UserInfo info) throws ServerException;
	
	
	public User getLoginUser() throws ServerException;
	
	public User updateAccount(User user) throws ServerException;
	
	
	
	public ActiveCluster[] getActiveCluster(boolean allClusters) throws ServerException;
	public ActiveCluster startCluster(ClusterData data) throws ServerException;
	public String killCluster(long id) throws ServerException;
	public String getClusterKey(long id) throws ServerException;
	public ClusterRet getClusterHistory(int start, int limit) throws ServerException;
	
}
